package cn.shanke.torrentmanagerserver.btclient;

import cn.shanke.torrentmanagerserver.btclient.model.TmSessionInfo;
import cn.shanke.torrentmanagerserver.btclient.model.TmTorrentInfo;
import cn.shanke.torrentmanagerserver.btclient.model.TmTorrentInfoSimple;
import cn.shanke.torrentmanagerserver.model.Client;
import lombok.Getter;
import lombok.Setter;
import nl.stil4m.transmission.api.domain.SessionStats;
import nl.stil4m.transmission.rpc.RpcException;

import java.io.IOException;
import java.nio.file.Path;
import java.util.List;

@Getter
@Setter
public abstract class BtClient {

    public static final String ACTION_START  = "start";
    public static final String ACTION_STOP   = "stop";
    public static final String ACTION_VERIFY = "verify";

    protected Client config;

    public abstract SessionStats getSessionStats() throws RpcException;

    public abstract TmSessionInfo getSessionInfo() throws RpcException;

    public abstract TmTorrentInfo addTorrent(String url, String metainfo, String downloadPath, boolean start) throws RpcException;

    public abstract TmTorrentInfo addTorrent(String url, String downloadPath, boolean start) throws RpcException;

    public abstract TmTorrentInfo addTorrent(Path torrentFilePath, String downloadPath, boolean start) throws RpcException, IOException;

    public abstract List<TmTorrentInfoSimple> getAllTorrentInfo() throws RpcException;

    public abstract TmTorrentInfo getTorrentInfo(String id) throws RpcException;

    public abstract TmTorrentInfoSimple getTorrentInfoSimple(String id) throws RpcException;

    public abstract List<TmTorrentInfo> getTorrentInfo(List<String> ids) throws RpcException;

    public abstract void setTorrentLocation(List<String> ids, String location, boolean move) throws RpcException;

    public abstract void verify(List<String> ids) throws RpcException;

    public abstract void removeTorrent(List<String> ids, boolean delFile) throws RpcException;

    public abstract void stop(List<String> ids) throws RpcException;

    public abstract void start(List<String> ids) throws RpcException;
}
